//
//  LSZSongCollectionListManager.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/5/15.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZSongCollectionListManager.h"

@implementation LSZSongCollectionListManager
-(id)initWithSongCollectionList :(NSDictionary *)dic
{
    self = [super init];
    if (self) {
        self.arrayData = [[NSMutableArray alloc]init];
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSString class]]) {
            return self;
        }
        if ([[dic valueForKey:@"data"] isKindOfClass:[NSNumber class]]) {
            return self;
        }
        if (![dic valueForKey:@"data"]) {
            return self;
        }
        NSArray * arrayDataDic = dic[@"data"];
        NSMutableArray * arrayAddMg = [[NSMutableArray alloc]init];
        for (NSDictionary * dicTionData in arrayDataDic) {
            LSZSongCollectionListMg * mg = [[LSZSongCollectionListMg alloc]init];
            mg.cat = NullStringjudgment(NSStr(dicTionData[@"cat"]));
            mg.type = NullStringjudgment(NSStr(dicTionData[@"type"]));
            mg.resource = NullStringjudgment(NSStr(dicTionData[@"resource"]));
            mg.id_big = NullStringjudgment(NSStr(dicTionData[@"id"]));

            if([dicTionData[@"detail"] isKindOfClass:[NSDictionary class]]){
                mg.singerName = NullStringjudgment(NSStr(dicTionData[@"detail"][@"singerName"]));
                mg.id_id = NullStringjudgment(NSStr(dicTionData[@"detail"][@"id"]));

                if ([[dicTionData[@"detail"] allKeys] containsObject:@"parentId"]) {
                    mg.parentId = NullStringjudgment(NSStr(dicTionData[@"detail"][@"parentId"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"title"]) {
                    mg.title = NullStringjudgment(NSStr(dicTionData[@"detail"][@"title"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"duration"]) {
                    mg.duration = NullStringjudgment(NSStr(dicTionData[@"detail"][@"duration"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"fileUrl"]) {
                    mg.fileUrl = NullStringjudgment(NSStr(dicTionData[@"detail"][@"fileUrl"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"shareUrl"]) {
                    mg.shareUrl = NullStringjudgment(NSStr(dicTionData[@"detail"][@"shareUrl"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"album"]) {
                    mg.album = NullStringjudgment(NSStr(dicTionData[@"detail"][@"album"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"click"]) {
                    mg.originalClick = NullStringjudgment(NSStr(dicTionData[@"detail"][@"click"]));
                    mg.click  = [LSZSpecialPackaging theNumberViewsForTheAlbumAhanges:mg.originalClick];
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"n"]) {
                    mg.n = NullStringjudgment(NSStr(dicTionData[@"detail"][@"n"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"content"]) {
                    mg.content = NullStringjudgment(NSStr(dicTionData[@"detail"][@"content"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"total_song"]) {
                    mg.total_song = NullStringjudgment(NSStr(dicTionData[@"detail"][@"total_song"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"image"]) {
                    mg.image = NullStringjudgment(NSStr(dicTionData[@"detail"][@"image"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"type"]) {
                    mg.type_type = NullStringjudgment(NSStr(dicTionData[@"detail"][@"type"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"hits"]) {
                    mg.originalHits = NullStringjudgment(NSStr(dicTionData[@"detail"][@"hits"]));
                    mg.hits  = [LSZSpecialPackaging theNumberViewsForTheAlbumAhanges:mg.originalHits];
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"likes"]) {
                    mg.likes = NullStringjudgment(NSStr(dicTionData[@"detail"][@"likes"]));
                }
                if ([[dicTionData[@"detail"] allKeys] containsObject:@"artist_name"]) {
                    mg.artist_name = NullStringjudgment(NSStr(dicTionData[@"detail"][@"artist_name"]));
                }if ([[dicTionData[@"detail"] allKeys] containsObject:@"album_name"]) {
                    mg.album_name = NullStringjudgment(NSStr(dicTionData[@"detail"][@"album_name"]));
                }

            }
            [arrayAddMg addObject:mg];
        }
        self.arrayData  = arrayAddMg;
    }
    return self;
}
@end

@implementation LSZSongCollectionListMg

@end
